class Course < ActiveRecord::Base
    validates_presence_of :name, :logo_url, :term, :scheduled_time, :syllabus_url, :schedule_url
    validates_uniqueness_of :name 
    validates_format_of :logo_url, 
      :with => %r{\.(gif|jpg|png|bmp)$}i, 
      :message => "must be a URL for a GIF, JPG, BMP, or PNG image" 
    validates_format_of :syllabus_url, 
      :with => %r{\.(doc|pdf|txt|rtf|odt)$}i, 
      :message => "must be a URL for a DOC, PDF, TXT, ODT, or RTF file" 
    validates_format_of :schedule_url, 
      :with => %r{\.(doc|pdf|txt|rtf|odt)$}i, 
      :message => "must be a URL for a DOC, PDF, TXT, ODT, or RTF file" 
      
    protected
      def self.find_course 
          find(:first)
      end
    
end
